/* commonJS 测试 */

/*
 * commonJS 实例
 * 1、规范写法
 */

console.log('start')
var lib = require('./lib.js')
console.log('end')
console.log(lib)
lib.name = 'allen'


/*
 * 2、石头剪刀布的游戏
 * 让进程一直存活，进行交互
 */
const game = require('gameLib.js')
let count = 0
process.stdin.on('data', e=> {
    const playerAction = e.toString().trim()
    const result = game(playerAction)
    if (result === -1) {
        count++;
    }
    if (count === 3) {
        console.log('你太厉害了，咱不玩了')
        process.exit()
    }
})